﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows.Controls;
using System.Windows;

namespace Microsoft.Forums.ForumsClient.ThreadedView
{
    /// <summary>
    /// A Tree view with columns
    /// </summary>
    public class ColumnsTreeView : TreeView
    {
        /// <summary>
        /// The columns in the columns tree view
        /// </summary>
        private GridViewColumnCollection columns;

        /// <summary>
        /// Creates or identifies the element that is used to display the given item.
        /// </summary>
        /// <returns>The element that is used to display the given item.</returns>
        protected override DependencyObject GetContainerForItemOverride()
        {
            
            return new ColumnsTreeViewItem();
        }

        /// <summary>
        /// Determines whether the specified item is its own container or can be its own container.
        /// </summary>
        /// <param name="item">The object to evaluate.</param>
        /// <returns>true if item is a ColumnsTreeViewItem; otherwise, false.</returns>
        protected override bool IsItemItsOwnContainerOverride(object item)
        {
            return item is ColumnsTreeViewItem;
        }

        #region Public Properties

        /// <summary> List of columns in the tree view</summary>
        public GridViewColumnCollection Columns
        {
            get
            {
                if (columns == null)
                {
                    columns = new GridViewColumnCollection();
                }
                
                return columns;
            }
        }

        #endregion
    }
}
